﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace KeyRemapper
{
    public partial class frmSettings : Form
    {
        public frmSettings()
        {
            InitializeComponent();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Seed = (int)nupSeed.Value;
            Properties.Settings.Default.UseDynamicKeymap = rbDynamic.Checked;
            Properties.Settings.Default.Save();

            Hide();

            Program.Instance.Remapper.Update(Properties.Settings.Default.UseDynamicKeymap, Properties.Settings.Default.Seed);
        }

        private void frmSettings_Load(object sender, EventArgs e)
        {
            nupSeed.Value = Properties.Settings.Default.Seed;

            rbStatic.Checked = !Properties.Settings.Default.UseDynamicKeymap;
            rbDynamic.Checked = Properties.Settings.Default.UseDynamicKeymap;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Hide();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}
